﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Manager/Manager.master" AutoEventWireup="true" CodeFile="ManagerCategory.aspx.cs" Inherits="Manager_ManagerCategory" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageTitle" Runat="Server">
Manager Category<% Response.Write(Session["PageName"]); %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageHeader" Runat="Server">
    <link type="text/css" rel="stylesheet" href="../Style/dataTables.css" />   
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="BodyContent" Runat="Server">
 <div class="header">
        <span><span class="ico  gray spreadsheet"></span>Manager Category </span>
    </div>
    <!-- End header -->
    <div class=" clear">
    </div>
    <div class="content">
        <p>
            <a id="addNew" title="Add">Add new category</a></p>
        <p>
        <asp:Label ID="lblmes" runat="server" Text=""></asp:Label>
            
            <asp:GridView ID="grvCategory" runat="server" AutoGenerateColumns="False" 
                CellPadding="4" DataKeyNames="ID" 
                ForeColor="#333333" GridLines="None" AllowPaging="True" PageSize='5' 
                onpageindexchanging="grvCategory_PageIndexChanging" CssClass="tablegrid">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:BoundField DataField="ID" HeaderText="ID" />
                    <asp:BoundField DataField="CategoryName" HeaderText="CategoryName" />
                    <asp:BoundField DataField="Description" HeaderText="Description" />
                    <asp:TemplateField HeaderText="Action">
                        <ItemTemplate>
                           <asp:LinkButton ID="edit" OnClientClick='<%# "EditCategory(" + Eval("ID") + ")" %>' runat="server" Enabled="False"><img src="../Images/icon/icon_edit.png" /></asp:LinkButton>
                            <asp:LinkButton ID="del" OnClientClick='<%# "DeleteCategory(" + Eval("ID") + ")" %>' runat="server" CausesValidation="False" EnableViewState="False" Enabled="False" ClientIDMode="AutoID">
                               <img src="../Images/icon/icon_delete.png" /></asp:LinkButton>
                            
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EditRowStyle BackColor="#2461BF" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#ffffff" BorderStyle="None" ForeColor="#999" HorizontalAlign="Right" />
                <RowStyle BackColor="#EFF3FB" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#F5F7FB" />
                <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                <SortedDescendingCellStyle BackColor="#E9EBEF" />
                <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>
            
        </p>

        
        <script language="javascript" type="text/javascript">
            $(document).ready(function () {

                //add candidate
                $("#addNew").click(function () {
                    window.location.href = 'AddNewCategory.aspx';
                });

            })

            function EditCategory(CategoryID) {
                window.location.href = 'EditCategory.aspx?ID=' + CategoryID;
            }

            function DeleteCategory(CategoryID) {
                if (confirm("Delete category : " + CategoryID + "?")) {
                    $.post("../ajax.asmx/DeleteCategory",
                    {
                        CategoryID: CategoryID
                    },
                    function (data) {
                        window.location.href = 'ManagerCategory.aspx';
                    }).error(function () { alert("Error! Cannot delete category"); });
                }
                else
                    return false;
            }
        </script>
    </div>
</asp:Content>

